package models;



import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import play.data.validation.Email;
import play.data.validation.MaxSize;
import play.data.validation.Required;
import play.db.jpa.Model;
import controllers.Application;

@Entity
public class User  extends Model {
	/**
	 * email
	 */
	@Column( unique = true )
	@Required
	@Email
	public String email;

	/**
	 * password md5 hash (64 bits raw)
	 */
	@Required
	public String pwdHash;

	/**
	 * system admin?
	 */
	public boolean isAdmin;

	/**
	 *
	 * @Description Activation Hash
	 */
	public String activationHash;
	@OneToMany (mappedBy = "voter")
	public List<Answer> answers=new ArrayList<Answer>();;
	/**
	 * 
	 * @Description did this user confirm his Account?
	 */
	public boolean isActivated;
	public User()
	{
		this.activationHash = Application.random_hash( 32 );
	}

}
